import { defineStore } from 'pinia'

export const useStore = defineStore('user-storeId', {
    state: () => ({
        token: localStorage.getItem('token') as (string | null)
    }),
    actions: {
        setToken(newToken: string) {
            this.token = newToken
            localStorage.setItem('token', newToken)
        },
        clearToken() {
            this.token = '';
            localStorage.removeItem('token')
        }
    }
})